﻿@page "/_School/School/Create"
@using WBBvNext.ViewModel._School.SchoolVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.FormRow">

            <BootstrapInput @bind-Value="@Model.Entity.SchoolCode"  />
            <BootstrapInput @bind-Value="@Model.Entity.SchoolName"  />
            <Select @bind-Value="@Model.Entity.SchoolType"  PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]"/>
            <WTUploadFile @bind-Value="@Model.Entity.PdfFileId" CSKey="School" Accept="application/pdf" />
            <BootstrapInput @bind-Value="@Model.Entity.Remark"  />
    </Row>
    <div class="modal-footer table-modal-footer">
        <Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
        <Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Create"]" IsAsync="true" />
    </div>
</ValidateForm>

@code {

    private SchoolVM Model = new SchoolVM();
    private ValidateForm vform { get; set; }


    protected override async Task OnInitializedAsync()
    {

        await base.OnInitializedAsync();
    }


    private async Task Submit(EditContext context)
    {
        await PostsForm(vform, "/api/School/add", (s) => "Sys.OprationSuccess");
    }

    public void OnClose()
    {
        CloseDialog();
    }

}
